home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / tutor / cptuts22.arj / TRUCK.CPP < prev    next >
C/C++ Source or Header  |  1992-01-20  |  416b  |  28 lines

  1.                                   // Chapter 7 - Program 7
  2. #include "truck.h"
  3.  
  4. void truck::init_truck(int how_many, float max_load)
  5. {
  6.    passenger_load = how_many;
  7.    payload = max_load;
  8. }
  9.  
  10.  
  11. float truck::efficiency(void)
  12. {
  13.    return payload / (payload + weight);
  14. }
  15.  
  16.  
  17. int truck::passengers(void)
  18. {
  19.    return passenger_load;
  20. }
  21.  
  22.  
  23.  
  24.  
  25. // Result of execution
  26. //
  27. // (this file cannot be executed)
  28.